package cn.buk.tms.train.dao;

import cn.buk.tms.dao.BaseAbstractDao;
import cn.buk.tms.dto.TrainOrderPassengerDto;
import cn.buk.tms.entity.misc.OperationLog;
import cn.buk.tms.entity.order.train.TrainOrder;
import cn.buk.tms.train.sc.TrainOrderSearchCriteria;

import java.util.List;

/**
 * 火车票订单保存接口
 *
 * @author yfdai
 */
public interface TrainOrderDao extends BaseAbstractDao {

    /**
     * 保存火车票订单
     *
     * @param o
     * @return
     */
    int createTrainOrder(TrainOrder o);

    int createTrainOrders(List<TrainOrder> list);

    TrainOrder getTrainOrderById(int id);

    TrainOrder getTrainOrderByOrderNo(int enterpriseId, String orderNo);

    List<TrainOrder> searchTrainOrders(int enterpriseId, TrainOrderSearchCriteria sc, List<Integer> allowedCustomerIds);

    /**
     * 修改火车票订单的备注
     *
     * @param enterpriseId
     * @param username
     * @param orderId
     * @param remark
     * @return
     */
    int updateTrainOrderRemark(int enterpriseId, String username, int orderId, String remark);

    int updateTrainOrderExternalOrderNo(int enterpriseId, String username, int orderId, String externalOrderNo);

    /**
     * 修改火车票订单的供应商
     *
     * @param enterpriseId
     * @param username
     * @param orderId
     * @param supplierId
     * @return
     */
    int updateTrainOrderSupplier(int enterpriseId, String username, int orderId, int supplierId);

    /**
     * 修改订单价格
     *
     * @param enterpriseId
     * @param username
     * @param orderId
     * @param price
     * @param cost
     * @param serviceCharge
     * @return
     */
    int updateTrainOrderPrice(int enterpriseId, String username, int orderId, double price, double cost, double serviceCharge, double totalAmount, double totalCost, double profit);

    int updateTrainOrderPassenger(int enterpriseId, String username, int orderId, TrainOrderPassengerDto psgDto);

    /**
     * 修改火车票订单的支付方式
     *
     * @param enterpriseId
     * @param username
     * @param orderId
     * @param paymentMethodId
     * @return
     */
    int updateTrainOrderPaymentMethod(int enterpriseId, String username, int orderId, int paymentMethodId);

    int processTrainOrder(int enterpriseId, String username, int orderId);

    int finishTrainOrder(int enterpriseId, String username, int orderId, String remark);

    List<OperationLog> searchTrainOrderHistory(int enterpriseId, int orderId);

    /**
     * 取消火车票订单
     *
     * @param enterpriseId
     * @param username
     * @param hotelOrderId
     * @param remark
     * @return
     */
    int cancelTrainOrder(int enterpriseId, String username, int hotelOrderId, String remark);

    int rollbackTrainOrder(int enterpriseId, String username, int orderId, final String remark);


    List<TrainOrder> searchUnpaidOrders(int max);

}
